﻿<%@page pageEncoding="utf-8" %>
<%@include file="/util/tag.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <%@include file="../common/head.jsp"%>
    <script language="javascript" type="text/javascript">
            //保存成功的提示信息
            function showResult() {
                showResultDiv(true);
                window.setTimeout("showResultDiv(false);", 3000);
            }
            function showResultDiv(flag) {
                var divResult = document.getElementById("save_result_info");
                if (flag)
                    divResult.style.display = "block";
                else
                    divResult.style.display = "none";
            }

            //显示修改密码的信息项
            function showPwd(chkObj) {
                if (chkObj.checked)
                    document.getElementById("divPwds").style.display = "block";
                else
                    document.getElementById("divPwds").style.display = "none";
            }
            
           $(function(){
             $("#accountForm").validate({
             	rules:{
             		"oldpwd":"required",
             		"newpwd":"required",
             		"conpwd":{required:true,equalTo:"#password"}
             	},messages:{
             		"oldpwd":"请填写旧密码",
             		"newpwd":"请填写新密码",
             		"conpwd":{required:"请填写确认密码",equalTo:"两次密码必须相同"}
             	},errorPlacement:function(error,element) {
            		 error.appendTo(element.siblings(":last").addClass("error_msg"));
            		 },success:function(label,element){
            		 	$(element).siblings(":last").removeClass("error_msg").empty();
            		 }
             });
            	$('#save').click(function(){
            	var b = true;
            							if($("#chkModiPwd").attr("checked")){
            								b = $('#accountForm').valid();
            							}
            	if(!b) return ;
            			b=$('#accountForm').submitForm('update','保存失败，旧密码错误！','保存成功!',$('#save_result_info'));
            			if(b){
            				$('#save_result_info').attr("class","save_success");
            			}else{
            				$('#save_result_info').attr("class","save_fail");
            			}
            			showResult();
            	
            	});
            });
     </script>
    <body>
        <%@include file="../common/top.jsp"%>
        
        <div id="main">  
            <!--保存成功或者失败的提示消息-->          
            <div id="save_result_info" class="save_fail">保存失败，旧密码错误！</div>
            <s:form cssClass="main_form" id="accountForm" theme="simple" method="post" action="update">
                    <!--必填项-->
                    <div class="text_info clearfix"><span>账务账号ID：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.id" readonly="true" cssClass="readonly"/>
                    </div>
                    <div class="text_info clearfix"><span>姓名：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.realName" readonly="true" cssClass="readonly"/>
                        <span class="required">*</span>
                        <div class="validate_msg_long"></div>
                    </div>
                    <div class="text_info clearfix"><span>身份证：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.idcardNo" readonly="true" cssClass="readonly"/>
                    </div>
                    <div class="text_info clearfix"><span>登录账号：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.loginName" readonly="true" cssClass="readonly"/>
                        <div class="change_pwd">
                            <input id="chkModiPwd" type="checkbox" name="modifypwd" value="true" onclick="showPwd(this);" />
                            <label for="chkModiPwd">修改密码</label>
                        </div>
                    </div>
                    <!--修改密码部分-->
                    <div id="divPwds">
                        <div class="text_info clearfix"><span>旧密码：</span></div>
                        <div class="input_info">
                            <input type="password" name="oldpwd" />
                            <span class="required">*</span>
                            <div class="validate_msg_long"></div>
                        </div>
                        <div class="text_info clearfix"><span>新密码：</span></div>
                        <div class="input_info">
                            <input type="password"  name="newpwd" id="password"/>
                            <span class="required">*</span>
                            <div class="validate_msg_long"></div>
                        </div>
                        <div class="text_info clearfix"><span>重复新密码：</span></div>
                        <div class="input_info">
                            <input type="password" name="conpwd" id="conpwd"/>
                            <span class="required">*</span>
                            <div class="validate_msg_long"></div>
                        </div>  
                    </div>                   
                    <div class="text_info clearfix"><span>电话：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.telephone" cssClass="width200"/>
                        <span class="required">*</span>
                        <div class="validate_msg_medium"></div>
                    </div>
                    <div class="text_info clearfix"><span>推荐人身份证号码：</span></div>
                    <div class="input_info">
                        <s:textfield name="idcardNo"/>
                        <div class="validate_msg_long error_msgs"></div>
                    </div>
                    <div class="text_info clearfix"><span>生日：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.birthdate" readonly="true" cssClass="readonly"/>
                    </div>
                    <div class="text_info clearfix"><span>Email：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.email" cssClass="width200"/>
                        <div class="validate_msg_medium"></div>
                    </div> 
                    <div class="text_info clearfix"><span>职业：</span></div>
                    <div class="input_info">
                        <s:select list="occupationOptions" name="act.occupation"></s:select>                       
                    </div>
                    <div class="text_info clearfix"><span>性别：</span></div>
                    <div class="input_info fee_type">
                        <input type="radio" name="act.gender" value="0"<c:if test="${act.gender==0}">checked</c:if>  id="female" onclick="feeTypeChange(1);" />
                        <label for="female">女</label>
                        <input type="radio" name="act.gender" value="1" <c:if test="${act.gender==1}">checked</c:if> id="male" onclick="feeTypeChange(2);" />
                        <label for="male">男</label>
                    </div> 
                    <div class="text_info clearfix"><span>通信地址：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.mailaddress" cssClass="width350"/>
                        <div class="validate_msg_tiny">50长度以内</div>
                    </div> 
                    <div class="text_info clearfix"><span>邮编：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.zipcode"/>
                        <div class="validate_msg_long">6位数字</div>
                    </div> 
                    <div class="text_info clearfix"><span>QQ：</span></div>
                    <div class="input_info">
                        <s:textfield name="act.qq"/>
                        <div class="validate_msg_long">5到13位数字</div>
                    </div>                
                    <!--操作按钮-->
                    <div class="button_info clearfix">
                        <input type="button" value="保存" class="btn_save" id="save" />
                        <input type="button" value="取消" class="btn_save" onclick="location='list?shidcardNo=${shidcardNo }&shrealName=${shrealName }&shloginName=${shloginName}&shstatus=${shstatus}&page=${page}'"/>
                    </div>
                </s:form> 
        </div>
        
        <%@include file="../common/bottom.jsp"%>
    </body>
</html>
